home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 2).iso
/
1276
/
test40.frm
< prev
next >
Wrap
Text File
|
1996-05-11
|
7KB
|
293 lines
VERSION 4.00
Begin VB.Form TestForm
Caption = "This is a test project for Project Analyzer"
ClientHeight = 1080
ClientLeft = 1095
ClientTop = 1485
ClientWidth = 5160
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 1485
Icon = "TEST40.frx":0000
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 1080
ScaleWidth = 5160
Top = 1140
Width = 5280
Begin VB.PictureBox Picture1
Height = 495
Left = 3180
MouseIcon = "TEST40.frx":030A
MousePointer = 99 'Custom
Picture = "TEST40.frx":074C
ScaleHeight = 435
ScaleWidth = 555
TabIndex = 4
Top = 60
Width = 615
End
Begin VB.DriveListBox Drive1
Height = 315
Left = 1140
MouseIcon = "TEST40.frx":14CE
MousePointer = 99 'Custom
TabIndex = 3
Top = 660
Width = 2475
End
Begin VB.ListBox List1
Height = 645
ItemData = "TEST40.frx":1910
Left = 60
List = "TEST40.frx":191D
MouseIcon = "TEST40.frx":1939
MousePointer = 99 'Custom
TabIndex = 2
Top = 360
Width = 915
End
Begin VB.CommandButton Quit
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Quit"
Height = 330
Left = 3780
TabIndex = 0
Top = 630
Width = 1275
End
Begin VB.Image Image2
Appearance = 0 'Flat
Height = 240
Left = 4320
Picture = "TEST40.frx":1A8B
Top = 120
Width = 240
End
Begin VB.Image Image1
Appearance = 0 'Flat
Height = 240
Left = 3960
Picture = "TEST40.frx":1B8D
Top = 120
Width = 240
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "This program will not do anything"
ForeColor = &H80000008&
Height = 225
Left = 210
TabIndex = 1
Top = 90
Width = 3000
End
End
Attribute VB_Name = "TestForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
' A test project for Project Analyzer
' (C)1996 MyCompany Ltd.
' This is the form of the main screen
' This file also includes some important database routines
DefStr W
Public DatabaseName$
Dim Weekdays(0 To 6)
' Project Analyzer doesn't understand MAX_BUTTONS isn't dead
Const MAX_BUTTONS = 50
Dim Button(0 To MAX_BUTTONS) As CommandButton
Dim FName As String
' This is a module-level variable that overrides the
' global variable FName in Test40.bas
Public FName2 As String
' This is a completely legal declaration in VB 4.0
' There is already a Public FName2 declared in Test40.bas
' This is another one
' Dim and Private mean the same here
Dim TestObject As TestClass
Private AnotherTestObject As New TestClass
Private Sub CloseDatabase()
' Close the database
' Check that all information is up-to-date
ReDim Preserve Button(0 To MAX_BUTTONS / 2) As CommandButton
End Sub
Private Function ExtensionOnly(ByVal File As String) As String
' Returns file name extension "BAS"
' This is a module-level function that will override
' the global function ExtensionOnly defined in FILETEST.BAS
ExtensionOnly = Right(File, 3)
End Function
Private Function Fibonacci(ByVal n As Integer)
' Sample of a recursive call sequence
' This function is only called by SumFibonacci
' but not by any other procedure
' -> Fibonacci and SumFibonacci are dead code
If n = 1 Then
Fibonacci = 1
ElseIf n = 2 Then
Fibonacci = 1
Else
Fibonacci = SumFibonacci(n - 1, n - 2)
End If
End Function
Private Sub Form_Load()
' Start of the program
Set Button(0) = Quit
Set TestObject = New TestClass
Dim TestObject2 As TestClass
Set TestObject2 = TestObject
' This is a reference to Property Let Value in TestClass
TestObject2.Value = 18
' These are 1) a reference to Property Let Value
' and 2) a reference to Property Get Value in TestClass
TestObject2.Value = TestObject2.Value + 1
ReadINIFile
OpenDB
RunTheProgram
End Sub
Private Sub Form_Unload(Cancel As Integer)
' Quit the program
' First close the database
Set TestObject = Nothing
CloseDatabase
End
End Sub
Private Sub OpenDB()
' Opening the DB
' Check for user rights
' Lock appropriate tables
' Now we reference ExtensionOnly in this file
If ExtensionOnly(FName) = "TXT" Then
'
' Then we reference ExtensionOnly in FileTest
ElseIf FileModule.ExtensionOnly(FName) = "TXT" Then
ElseIf IsDir("C:\WINDOWS") Then
If DriveType("C:", Drive1) <> DRIVE_FIXED Then
' Panic
Else
' Don't panic
End If
End If
End Sub
Private Sub Image1_Click()
' This procedure tests the With statement
Const Value = 88
With TestObject
' Reference a property and a local const
.Value = .Value + Value
' Call TestClass.ShowPublicHello
.ShowPublicHello
' Call TestForm.ShowPublicHello
ShowPublicHello
End With
' Another with statement
With Me
' Call TestForm.ShowPublicHello again
.ShowPublicHello
End With
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button > 1 Then AnotherTestObject.ShowPublicHello
End Sub
Private Sub Quit_Click()
Unload Me
End Sub
Private Sub ReadINIFile()
' Read the configuration in PROJTEST.INI
' Note: If PROJTEST.INI doesn't exist, use defaults
IsThere = IsFile("PROJTEST.INI")
End Sub
Private Sub RunTheProgram()
' Run the program only if there is at least 1 MB free
' disk space
' Otherwise show error message
If DiskSpaceFree("C:") < 1024 ^ 2 Then
End If
End Sub
Private Function SumFibonacci(a, b)
' Sample of a recursive call sequence
' This function is only called by Fibonacci
' but not by any other procedure
' -> Fibonacci and SumFibonacci are dead code
SumFibonacci = Fibonacci(a) + Fibonacci(b)
End Function
Public Sub Blink()
Attribute Blink.VB_Description = "This sub changes the background color\r\nof the form"
BackColor = &HFF00FF
End Sub
Public Sub ShowPublicHello()
' This sub is here to assure that Project Analyzer
' can make difference between
' TestClass.ShowPublicHello and TestForm.ShowPublicHello
MsgBox "Hellos from TestForm too!"
End Sub